//
//  NewPersonController.m
//  PosApp
//
//  Created by 李英新 on 2018/10/14.
//  Copyright © 2018年 李英新. All rights reserved.
//

#import "NewPersonController.h"
#import "NewPersonViewCell.h"

@interface NewPersonController ()<UICollectionViewDelegate,UICollectionViewDataSource>
@property (weak, nonatomic) IBOutlet UICollectionView *CollectionView;
@property (strong,nonatomic) NSArray * titleArr;

@end

@implementation NewPersonController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.title = @"新手指引";
    self.titleArr = @[@"如何注册",@"实名认证",@"代还功能",@"快捷支付",@"我的团队",@"我的盈利",@"如何升级",@"如何分享",@"如何提现",@"绑定支付宝",@"修改储蓄卡",@"修改密码"];
    UICollectionViewFlowLayout * layout = [[UICollectionViewFlowLayout alloc] init];
    layout.itemSize = CGSizeMake((KScreenW-3)/4, 80);
    layout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
    layout.minimumLineSpacing = 1;
    layout.minimumInteritemSpacing = 1;
    
    self.CollectionView.collectionViewLayout = layout;
    self.CollectionView.backgroundColor = [UIColor clearColor];
    self.CollectionView.delegate = self;
    self.CollectionView.dataSource = self;
    [self.CollectionView registerNib:[UINib nibWithNibName:@"NewPersonViewCell" bundle:nil] forCellWithReuseIdentifier:@"cell"];
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return self.titleArr.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    NewPersonViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
    cell.CellImage.image = [UIImage imageNamed:[NSString stringWithFormat:@"NewPersonImage%ld",indexPath.row+1]];
    cell.CellLabel.text = [NSString stringWithFormat:@"%@",self.titleArr[indexPath.row]];
    return cell;
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    [MBProgressHUD showAlertViewWithText:@"功能开发中"];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
